package com.aboo.dao.impl;

import java.util.List;

import com.aboo.dao.BaseSqlMapDao;
import com.aboo.dao.FrameResultDao;
import com.aboo.po.FrameResultPO;
import com.aboo.po.Page;
import com.aboo.pub.constant.Constant;

public class FrameResultDaoImpl extends BaseSqlMapDao implements FrameResultDao {

	public Integer save(FrameResultPO po) throws Exception {
		return (Integer) getSmcTemplate().insert("FrameResult.insertFrameResult", po);
	}

	public void delete(Integer id) throws Exception {
		FrameResultPO tmp = new FrameResultPO();
		tmp.setId(id);
		tmp.setInUse(Constant.INUSE_NO);
		getSmcTemplate().update("FrameResult.updateFrameResult", tmp);
	}

	public FrameResultPO find(FrameResultPO po) throws Exception {
		return (FrameResultPO) getSmcTemplate().queryForObject("FrameResult.selectFrameResultList", po);
	}

	public Integer findCount(FrameResultPO po) throws Exception {
		return (Integer) getSmcTemplate().queryForObject("FrameResult.selectFrameResultCount", po);
	}

	public List<FrameResultPO> findList(FrameResultPO po, Page page)
			throws Exception {
		if (page != null) {
			po.setBeginIndex(page.getBeginRecordIndex());
			po.setEndIndex(page.getEndRecordIndex());
		}
		po.addSort("ID", Constant.SORT_ASC);
		return getSmcTemplate().queryForList("FrameResult.selectFrameResultList", po);
	}

	public void update(FrameResultPO po) throws Exception {
		getSmcTemplate().update("FrameResult.updateFrameResult", po);
	}

}
